package com.zhangbaiyan.zhuse;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * @author zhangbaiyan
 * @date 2024-09-24 20:39
 * @description:
 * @version:
 */
public class test {
    public static void main(String[] args) {
        /*
        *
        *   需求:利用阻塞队列完成生产者和消费者(等待唤醒机制)的代码
        * 细节:
        *       生产者和消费者必须使用同一个阻塞队列
         */
        ArrayBlockingQueue<String> queue = new ArrayBlockingQueue<>(1);
        Cook cook = new Cook(queue);
        Foodie foodie = new Foodie(queue);

        cook.setName("厨师");
        foodie.setName("吃货");

        cook.start();
        foodie.start();





    }
}
